package chapter11.section4;

/*   Transaction：模拟一笔业务 */
public class Transaction {
    public static String DEPOSIT = "deposit";// 存款
    public static String WITHDRAW = "withdraw";// 取款
    // 该数组主要用于在排队机中随机不同的存取款事务
    public static String[] tranTypes = {"deposit", "withdraw"};
    private int num;// 流水号
    private Account account;// 每笔业务涉及的账户
    private int amount; // 每笔业务的金额
    private String tranType; // 业务发生类型

    public Transaction(int num, Account account, int amount, String tranType) {
        super();
        this.num = num;
        this.account = account;
        this.amount = amount;
        this.tranType = tranType;
    }
    // todo，这里省略了此类每个属性的getter和setter方法，请添加完整保证运行正确

    /**
     * @return the dEPOSIT
     */
    public static String getDEPOSIT() {
        return DEPOSIT;
    }

    /**
     * @param deposit the dEPOSIT to set
     */
    public static void setDEPOSIT(String deposit) {
        DEPOSIT = deposit;
    }

    /**
     * @return the wITHDRAW
     */
    public static String getWITHDRAW() {
        return WITHDRAW;
    }

    /**
     * @param withdraw the wITHDRAW to set
     */
    public static void setWITHDRAW(String withdraw) {
        WITHDRAW = withdraw;
    }

    /**
     * @return the tranTypes
     */
    public static String[] getTranTypes() {
        return tranTypes;
    }

    /**
     * @param tranTypes the tranTypes to set
     */
    public static void setTranTypes(String[] tranTypes) {
        Transaction.tranTypes = tranTypes;
    }

    @Override
    public String toString() {
        return "Transaction [num=" + num + ", account=" + account + ", amount=" + amount + ", tranType=" + tranType + "]";
    }

    /**
     * @return the num
     */
    public int getNum() {
        return num;
    }

    /**
     * @param num the num to set
     */
    public void setNum(int num) {
        this.num = num;
    }

    /**
     * @return the account
     */
    public Account getAccount() {
        return account;
    }

    /**
     * @param account the account to set
     */
    public void setAccount(Account account) {
        this.account = account;
    }

    /**
     * @return the amount
     */
    public int getAmount() {
        return amount;
    }

    /**
     * @param amount the amount to set
     */
    public void setAmount(int amount) {
        this.amount = amount;
    }

    /**
     * @return the tranType
     */
    public String getTranType() {
        return tranType;
    }

    /**
     * @param tranType the tranType to set
     */
    public void setTranType(String tranType) {
        this.tranType = tranType;
    }
}
